home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10569 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  51 lines

  1. Path: doc.ic.ac.uk!not-for-mail
  2. From: njs3@doc.ic.ac.uk (Niall Smart)
  3. Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
  4. Subject: Re: Seek unix2dos.c OR help with tr
  5. Date: 18 Mar 1996 19:45:13 -0000
  6. Organization: Dept. of Computing, Imperial College, University of London, UK.
  7. Distribution: world
  8. Message-ID: <4ikeg9$f7d@oak73.doc.ic.ac.uk>
  9. References: <4i0946$7io@nuke.csu.net> <4i0c31$r1g@solutions.solon.com>
  10. Reply-To: njs3@doc.ic.ac.uk (Niall Smart)
  11. NNTP-Posting-Host: oak73.doc.ic.ac.uk
  12. X-Newsreader: mxrn 6.18-23
  13.  
  14.  
  15. In article <4i0c31$r1g@solutions.solon.com>, seebs@solutions.solon.com (Peter Seebach) writes:
  16. |
  17. |>>#include <stdio.h>
  18. |>>main(){
  19. |>>char c;
  20. |>>while(EOF!=(c=getchar())){
  21. |>
  22. |>
  23. |>ARGH!!!
  24. |>
  25. |>How many times must this be said?
  26.  
  27. Until the C library makers replace getchar with getint of ppl start to
  28. use better function interfaces: i.e.
  29.  
  30. #define TRUE 1
  31. #define FALSE 0
  32.  
  33. typedef int bool
  34.  
  35. bool fGetChar(char *ch)
  36. {
  37.   int i;
  38.  
  39.   if ((i = getchar()) != EOF)
  40.     { 
  41.        *ch = i;
  42.        return TRUE;
  43.     }
  44.   else
  45.     {
  46.        return FALSE;
  47.     }
  48. }
  49.  
  50. Niall
  51.